﻿/*
 * Copyright (c) 2020-2025, Qingdao Digital Intelligent Ship & Ocean Technology Co., Ltd.
 * All rights reserved.
 *
 * This file is part of FastCAE and is distributed under the terms of the
 * BSD 3-Clause License. See the LICENSE file in the project root for details.
 */

/**********************************************************************
 * @file   FITKGeoToMeshMapper.h
 * @brief  几何到网格的映射
 * @author BaGuijun (baguijun@163.com)
 * @date   2025-08-28
 *********************************************************************/
#ifndef _FITKGeoToMeshMapper_
#define _FITKGeoToMeshMapper_

#include "FITKInterfaceMeshAPI.h"
#include <QObject>
#include <QHash>

namespace Interface
{
    /**
     * @brief  几何到网格的映射
     * @author BaGuijun (baguijun@163.com)
     * @date   2025-08-28
     */
    class FITKInterfaceMeshAPI FITKGeoToMeshMapper : public QObject
    {
    public:
        /**
         * @brief    构造函数
         * @author   BaGuijun (baguijun@163.com)
         * @date     2025-08-28
         */
        FITKGeoToMeshMapper();
        /**
         * @brief    析构函数
         * @author   BaGuijun (baguijun@163.com)
         * @date     2025-08-28
         */
        virtual ~FITKGeoToMeshMapper();
        /**
         * @brief    清空
         * @author   BaGuijun (baguijun@163.com)
         * @date     2025-09-23
         */
        void clear();
        /**
         * @brief    插入几何点ID与网格点ID映射信息
         * @param[i] geoNodeID                  几何点ID
         * @param[i] meshVertexID               网格点ID
         * @author   BaGuijun (baguijun@163.com)
         * @date     2025-09-01
         */
        void insertMeshVertexOfGeoNode(int geoNodeID, int meshVertexID);
        /**
         * @brief    移除几何点ID与网格点ID映射信息
         * @param[i] geoNodeID                  几何点ID
         * @author   BaGuijun (baguijun@163.com)
         * @date     2025-09-23
         */
        void removeMeshVertexOfGeoNode(int geoNodeID);
        /**
         * @brief    插入几何点ID与网格点ID映射信息
         * @return   QHash<int,int>             几何点ID与网格点ID映射信息
         * @author   BaGuijun (baguijun@163.com)
         * @date     2025-09-01
         */
        QHash<int, int> getMeshVertexOfGeoNode();
        /**
         * @brief    追加几何面所对应的网格单元信息
         * @param[i] faceID                     面ID
         * @param[i] eleID                      单元ID
         * @param[i] faceIndex                  面索引
         * @author   BaGuijun (baguijun@163.com)
         * @date     2025-08-29
         */
        void insertMeshEleOfGeoFace(int faceID, int eleID, int faceIndex);
        /**
         * @brief    移除几何面所对应的网格单元信息
         * @param[i] faceID                     面ID
         * @author   BaGuijun (baguijun@163.com)
         * @date     2025-09-23
         */
        void removeMeshEleOfGeoFace(int faceID);
        /**
         * @brief    几何面所对应网格单元ID
         * @return   QHash<int,QHash<int,int>>  映射表<几何面ID，<单元ID，单元的第几个面>>
         * @author   BaGuijun (baguijun@163.com)
         * @date     2025-08-29
         */
        QHash<int, QHash<int, int>> getMeshEleOfGeoFace();
        /**
         * @brief    追加几何边所对应的网格单元信息
         * @param[i] edgeID                     边ID
         * @param[i] eleID                      单元ID
         * @param[i] edgeIndex                  边索引
         * @author   BaGuijun (baguijun@163.com)
         * @date     2025-08-29
         */
        void insertMeshEleOfGeoEdge(int edgeID, int eleID, int edgeIndex);
        /**
         * @brief    移除几何边所对应的网格单元信息
         * @param[i] edgeID                     边ID
         * @author   BaGuijun (baguijun@163.com)
         * @date     2025-09-23
         */
        void removeMeshEleOfGeoEdge(int edgeID);
        /**
         * @brief    几何边所对应网格单元ID
         * @return   QHash<int,QHash<int,int>>  映射表<几何边ID，<单元ID，单元的第几条边>>
         * @author   BaGuijun (baguijun@163.com)
         * @date     2025-08-29
         */
        QHash<int, QHash<int, int>> getMeshEleOfGeoEdge();
        /**
         * @brief    添加几何体所对应网格单元ID列表
         * @param[i] solidID                    几何体ID
         * @param[i] meshEleID                  网格单元ID
         * @author   BaGuijun (baguijun@163.com)
         * @date     2025-08-28
         */
        void insertMapOfGeoSolid(int solidID, int meshEleID);
        /**
         * @brief    移除几何体所对应网格单元ID列表
         * @param[i] solidID                    几何体ID
         * @author   BaGuijun (baguijun@163.com)
         * @date     2025-09-23
         */
        void removeMapOfGeoSolid(int solidID);
        /**
         * @brief    几何体所对应的网格单元ID
         * @return   QHash<int,QList<int>>      映射表
         * @author   BaGuijun (baguijun@163.com)
         * @date     2025-08-29
         */
        QHash<int, QList<int>> getMeshEleOfGeoSolid();
    protected:
        /**
         * @brief  几何点所对应的网格点
         *         <几何点ID，网格点ID>
         * @author BaGuijun (baguijun@163.com)
         * @date   2025-09-01
         */
        QHash<int, int> _meshVerOfGeoNode = {};
        /**
         * @brief  几何边所对应网格单元ID
         *         <几何边ID，<单元ID，单元的第几条边>>
         * @author BaGuijun (baguijun@163.com)
         * @date   2025-08-28
         */
        QHash<int, QHash<int, int>> _meshEleOfGeoEdge = {};
        /**
         * @brief  几何面所对应网格单元ID
         *         <几何面ID，<单元ID，单元的第几个面>>
         * @author BaGuijun (baguijun@163.com)
         * @date   2025-08-28
         */
        QHash<int, QHash<int, int>> _meshEleOfGeoFace = {};
        /**
         * @brief  几何体所对应的网格单元ID
         * @author BaGuijun (baguijun@163.com)
         * @date   2025-08-28
         */
        QHash<int, QList<int>> _meshEleOfGeoSolid = {};
    };
}

#endif